package com.gugee.ins.common.dal.mapper.statistics;

import com.gugee.common.mapper.GugeeMapper;
import com.gugee.ins.common.dto.InsBloggerFollowerTypeDto;
import com.gugee.ins.common.model.mysql.statistics.InsStBloggerRealFollowing;
import org.apache.ibatis.annotations.Select;

public interface InsStBloggerRealFollowingMapper extends GugeeMapper<InsStBloggerRealFollowing> {

    @Select("select * from ins_st_blogger_real_following where uid = #{uid}")
    InsStBloggerRealFollowing findByUid(long uid);

    /**
     * 查询获取粉丝样本数，大量关注者数，可疑账户数
     * @param uid
     * @return
     */
    @Select("select IFNULL(sum(is_zombie),0) suspicious," +
            " IFNULL(sum(is_massive_following),0) massive_following,count(1) total from " +
            " (select f_uid from ins_rel_blogger_follower rb where uid = #{uid}) t1 " +
            " inner join ins_blogger t2 " +
            " on t1.f_uid = t2.uid " +
            " where t2.last_collect_time > 0 ")
    InsBloggerFollowerTypeDto findFollowerAndZombieByUid(long uid);
}